package svc

import (
	"api/client/goodClient"
	"api/client/orderClient"
	"api/client/userClient"
	"api/internal/config"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config   config.Config
	UserRpc  userClient.User
	GoodRpc  goodClient.Good
	OrderRpc orderClient.Order
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		UserRpc:  userClient.NewUser(zrpc.MustNewClient(c.UserRpc)),
		GoodRpc:  goodClient.NewGood(zrpc.MustNewClient(c.GoodRpc)),
		OrderRpc: orderClient.NewOrder(zrpc.MustNewClient(c.OrderRpc)),
	}
}
